<?php

class DateLib
{
	public static function FomatTimeToYmdHis($time = FALSE)
	{
		if ($time === FALSE)
		{
			$time = time ();
		}
		return date ( 'YmdHis', $time );
	}
	
	public static function getDateTime($time = FALSE)
	{
		if ($time === FALSE)
		{
			$time = time ();
		}
		return date ( 'Y-m-d H:i:s', $time );
	}
	
	/**
	 * 时间全部转化为就显示日期 ename lusb
	 * @param string $str
	 * @return string
	 */
	public static function getDate($str)
	{
		$str = strtotime ( $str );
		$str = date ( "Y-m-d", $str );
		return $str;
	}
	/**
	 * 时间全部转化为就显示日期,下划线的
	 *
	 * @param string $str
	 * @return string
	 */
	public static function getUnderLineDate($str)
	{
		$str = strtotime ( $str );
		$str = date ( "Y_m_d", $str );
		return $str;
	}
	
	/**
	 * 时间全部转化为就显示日期 ename lusb
	 *
	 * @param string $str
	 * @return string
	 */
	public static function getDeleteLineDate($str)
	{
		$str = strtotime ( $str );
		$str = date ( "Ymd", $str );
		return $str;
	}
	
	/**
	 * timestamp格式的时间转换为UNIX时间戳
	 *
	 * @param string $strtime
	 * @author zhangxy
	 */
	
	public function getTimeToDay($str)
	{
		$array = explode ( "-", $str );
		$year = $array [0];
		$month = $array [1];
		$array = explode ( ":", $array [2] );
		$minute = $array [1];
		$second = $array [2];
		$array = explode ( " ", $array [0] );
		$day = $array [0];
		$hour = $array [1];
		$timestamp = mktime ( $hour, $minute, $second, $month, $day, $year );
		return $timestamp;
	}
}

?>